package cn.com.sixboy.entity;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

/**
 * @author Sam.Zheng <zcl1866@sina.com>
 * @date 2013-5-4 14:07:08
 * @version <v0.1>
 * @copyright SixBoy
 */
@Entity
@Table(name = "student")
@NamedQueries({
		@NamedQuery(name = "findAllStudents", query = "select s from Student s order by  s.id"),
		@NamedQuery(name = "findAllStudentsByName", query = "select s from Student s where s.name like :name order by s.id") })
public class Student implements Serializable {
	@Id
	@TableGenerator(name = "stu", table = "sys_generator", pkColumnName = "key_name", pkColumnValue = "STU_ID", valueColumnName = "key_value", initialValue = 1, allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "stu")
	private Integer id;

	@Column(name = "name", length = 20)
	private String name;

	@ManyToOne
	@JoinColumn(name = "class_id")
	private Class s_class;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Class getS_class() {
		return s_class;
	}

	public void setS_class(Class s_class) {
		this.s_class = s_class;
	}

}
